/****************************************************************************** * Copyright (C) Ultraleap, Inc. 2011-2021. * * * * Use subject to the terms of the Apache License 2.0 available at * * http://www.apache.org/licenses/LICENSE-2.0, or another agreement * * between Ultraleap and you, your company or other organization. * ******************************************************************************/ using Leap; using Leap.Unity.Attributes; using Leap.Unity.Space; using System.Collections; using System.Collections.Generic; using UnityEngine; namespace Leap.Unity.Interaction { /// /// IInteractionBehaviour is the interface that defines all Interaction objects, /// specifying the minimum set of functionality required to make objects interactable. /// public interface IInteractionBehaviour /* : IInternalInteractionBehaviour */ { // Properties from MonoBehaviour. string name { get; } // (subclass MonoBehaviour to satisfy) GameObject gameObject { get; } // ^ Transform transform { get; } // ^ // Properties for interaction. InteractionManager manager { get; } Rigidbody rigidbody { get; } ISpaceComponent space { get; } // OK to return null if this object is not in // curved space. // Interaction overrides. IgnoreHoverMode ignoreHoverMode { get; } bool ignorePrimaryHover { get; } bool ignoreContact { get; } IgnoreHoverMode ignoreGraspingMode { get; } bool ignoreGrasping { get; } // Interaction settings. bool allowMultiGrasp { get; } // Interaction layers. SingleLayer interactionLayer { get; } SingleLayer noContactLayer { get; } // Called by the Interaction Manager manually // every fixed (physics) frame. void FixedUpdateObject(); // Interaction types: // - Hover // -- Primary Hover // - Contact // - Grasping // -- Suspension // Hover float GetHoverDistance(Vector3 worldPosition); void BeginHover(List beganHovering); void EndHover(List endedHovering); void StayHovered(List currentlyHovering); // Primary hover void BeginPrimaryHover(List beganPrimaryHovering); void EndPrimaryHover(List endedPrimaryHovering); void StayPrimaryHovered(List currentlyPrimaryHovering); // Contact void BeginContact(List beganContact); void EndContact(List endedContact); void StayContacted(List currentlyContacting); // Grasping bool isGrasped { get; } void BeginGrasp(List beganGrasping); void EndGrasp(List endedGrasping); void StayGrasped(List currentlyGrasping); // Suspension bool isSuspended { get; } void BeginSuspension(InteractionController beganSuspending); void EndSuspension(InteractionController endedSuspending); } }